$(".logout").click(function (e) {
  var userID = $("#userid").text()
  console.log("logout", userID)
  // 这里访问服务器看是否登陆过，如果登陆过就不许登陆
  // 简单js访问
  $.ajax(
    {
      url: "/api/logout",
      type: "POST",
      data: {
        userID
      },
      async: false,
      success: function (result) {
        console.log(result)
        if (result == "yes") {
          // 成功退出
          alert("Success")
        } else {
          alert(result)
        }
        console.log($(location))
        $(location).attr('href', $(location).attr('origin'))
      }
    }
  );
});